package com.ls.lserp.modules.order.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.ls.lserp.common.persistence.Page;
import com.ls.lserp.common.service.CrudService;
import com.ls.lserp.common.utils.ResourcesUtil;
import com.ls.lserp.modules.order.dao.QualityResultDao;
import com.ls.lserp.modules.order.entity.OperatingP;
import com.ls.lserp.modules.order.entity.OrderMateriel;
import com.ls.lserp.modules.order.entity.QualityResult;
import com.ls.lserp.modules.trade.entity.Enchase;


@Service
@Transactional(readOnly = false)
public class QualityResultService extends CrudService<QualityResultDao,QualityResult>{

	 	@Autowired
	    private QualityResultDao qualityResultDao ;

		public Page<QualityResult> findList(Page<QualityResult> page, QualityResult qualityResult) {
			// tab页分，检索条件设定(0:全部,1:已通过,2:未通过)
			int tabFlg = qualityResult.getTabPageStatus();
			if(1==tabFlg){
				qualityResult.setPackageStatus(ResourcesUtil.getConfig("quality_result_pass"));
			}else if(2==tabFlg){
				qualityResult.setPackageStatus(ResourcesUtil.getConfig("quality_result_no"));
			}else{
				qualityResult.setPackageStatus("");
			}
			
	        // 设置分页参数
			qualityResult.setPage(page);
	   	
			List<QualityResult> resultList = qualityResultDao.findList(qualityResult);
					
	       // 执行分页查询
	       page.setList(resultList);
	       
	       return page;
		}

		public List<QualityResult> findDetailsList(Long styleID,Long operatingID) {
			
			return qualityResultDao.findError(styleID,operatingID);
		}

		/**
	     * 得到工序信息
	     */
	    public List<OperatingP> getOperatingPList() {
	        return qualityResultDao.getOperatingPList();
	    }
		
	
}
